import javax.swing.*;
import java.awt.*;
import java.io.*;

/**
 * Created by BerkBozkurt on 14.5.2015.
 */
public class Scoreboard extends JLabel{


    private int score;

    public Scoreboard() {
        super();
        this.setSize(140, 60);
        this.setOpaque(false);
        this.setVisible(true);
        this.setForeground(Color.white);
        score = 0;

        try {
            InputStream myStream = new BufferedInputStream(new FileInputStream("resources/game.ttf"));
            Font font = Font.createFont(Font.TRUETYPE_FONT, myStream);
            Font biggerFont = font.deriveFont(Font.PLAIN, 20f);
            setFont(biggerFont);
        } catch (IOException | FontFormatException ex) {
            ex.printStackTrace();
        }
        setText(String.format("%05d", score));
    }
    public void addScore(int score) {
        this.score += score;
        setText(String.format("%05d", this.score));
    }

    public void setScore(int i) {
        score = 0;
        setText(String.format("%05d", score));
    }

    public int getScore() {
        return score;
    }

}
